package com.fitmanagement.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fitmanagement.entity.Usercard;
import com.fitmanagement.mapper.UsercardMapper;
import com.fitmanagement.service.IUsercardService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 虚空
 * @since 2024-11-11
 */
@Service
public class UsercardServiceImpl extends ServiceImpl<UsercardMapper, Usercard> implements IUsercardService {
    @Autowired
    private UsercardMapper usercardMapper;
    @Override
    public String selectColumn(int id) {
       return usercardMapper.selectColumn(id);
    }

    @Override
    public boolean updateCard(Integer id, Double blance, LocalDateTime maturityTime, LocalDateTime parchTime) {
         QueryWrapper<Usercard> queryWrapper = new QueryWrapper<>();
         QueryWrapper<Usercard> cardId = queryWrapper.eq("cardId", id);
         Usercard usercard = this.getOne(cardId);
         usercard.setBlance(blance);
         usercard.setMaturityTime(maturityTime);
         usercard.setParchTime(parchTime);
         this.updateById(usercard);
        return false;
    }
}
